<?php

	class newsModel extends Model{
		
		public function showNewsDetail($id){
			$sql = "select * from $this->tableName where id=$id";
			$newsInfo = $this->query($sql);
			return $newsInfo;
		}
	          //多表查询数据
	    public function bodyshow($id){
		   	$sql="select * from hd_news as s inner join hd_news_data as d on s.id=d.nid where id=$id";
		  
		   	$new=$this->query($sql);
		    
		   	return $new;
	     }
	
	     
	     
	     
	     
	     //添加点击次数
		public function addClickCount($id){
			$newsInfo = $this->showNewsDetail($id);
			$orignalCount = $newsInfo[0]["click"];
			$newClickCount = $orignalCount+1;
			$sql = "update $this->tableName set click=$newClickCount where id=$id";
			$affect_row = $this->exe($sql);
			if($affect_row==1){
				return true;
			}else{
				return false;
			}
		}
	   
	
	
	
	}
?>